<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_personal.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ti_address.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<jsp:useBean id="bean" class="com.lmpop.frame.util.RandomID" scope="page" />

  <% 
  	request.setCharacterEncoding("UTF-8");
  	Ts_areaInfo areaBean = new Ts_areaInfo();
  	String addr_id="";
  	if(request.getParameter("addr_id")!=null) addr_id = request.getParameter("addr_id");
  	Ti_addressInfo ti_addressInfo = new Ti_addressInfo();
  	List list = ti_addressInfo.getListByPk(addr_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String consignee="",infolevel="",email="",area_attr="",address="",post_code="",tel="",cellphone="",sign_building="",best_time="",s_user_id="",in_date="";
  	if(map.get("consignee")!=null) consignee = map.get("consignee").toString();
  	if(map.get("level_no")!=null) infolevel = map.get("level_no").toString();
  	if(map.get("email")!=null) email = map.get("email").toString();
  	if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
  	if(map.get("address")!=null) address = map.get("address").toString();
  	if(map.get("post_code")!=null) post_code = map.get("post_code").toString();
  	if(map.get("tel")!=null) tel = map.get("tel").toString();
  	if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
  	if(map.get("sign_building")!=null) sign_building = map.get("sign_building").toString();
  	if(map.get("best_time")!=null) best_time = map.get("best_time").toString();
  	if(map.get("user_id")!=null) s_user_id = map.get("user_id").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
	
			String areaAttr = "",areaoutput="";
			
		if (map.get("area_attr") != null) {
		area_attr = map.get("area_attr").toString();
		String areaArr[] = area_attr.split("\\|");
		for( int k = 0; k < areaArr.length; k++ ){
			areaoutput +=  areaBean.getAreaNameById( areaArr[k]) + "  ";	 		
		}
	}

  %>
	
<script language="javascript" type="text/javascript" src="commen.js"></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script language="javascript" type="text/javascript" src="js_customer.js"></script>
	
<div class="f-right">
    <table width="100%" cellpadding="0" cellspacing="0" class="table_main">
      <tr>
        <th width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif" /></th>
        <th width="75%"><h3>修改收货地址</h3></th>

      </tr>
    </table>

    <!--Content部分开始-->
    <DIV class="focus-area-setTab">
      <DIV class="focus-area-setTab-menu">
        <DIV class="clear"></DIV>
      </DIV>
      <DIV class="focus-area-setTab-content">
        <DIV id=con_one_1 >
          <table width="100%" border="0" cellspacing="0" cellpadding="0" style=" padding-left:15px;">
            <tr >
              <td height="100" valign="top">
		  	<form action="/doTradeReg.do" name="addForm" method="post">
			    <table width="100%" cellspacing="0" cellpadding="0">
			    <tr>
                    <td  height="38" class="art_col" width="10%">收货人姓名<font color="red">*</font></td>
                    <td width="40%"><input name="consignee" id="consignee" value="<%=consignee%>" type="text" maxlength="50" onkeyup= "value=value.replace(/[^\w\u4E00-\u9FA5]/g,'');"  onbeforepaste= "clearSBC();" >
					</td>
          </tr>
			   
			  <!--//      fixed by Zhouxq              -->
			  
			   
			<tr>					
					<td  height="38" class="art_col">所在地区<font color="red">*</font></td>
			
			<td colspan="3">
				<div id="org1">
					<font color="#CECECE"><span id="areaoutput"><%=areaoutput%></span></font>
					<input type="button" name="buttons" value="修改地区" class="button2" onclick="ChangeOrg()" />
				</div>
				<div style="display:none;" id="org2">
					<select name="province" id="province" onclick="setCitys(this.value)">
					  <option value="">省份</option> 
					</select>
					<select name="eparchy_code" id="eparchy_code" onclick="setAreas(this.value)">
					  <option value="">地级市</option> 
					 </select>
					<select name="city_code" id="city_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
				</div>
					<input type="hidden" name="area_attr_bak" id="area_attr_bak" value="<%=area_attr %>" />
					<input type="hidden" name="area_attr" id="area_attr" value="<%=area_attr %>" />
													
				</td>
			</tr>
              
			    <tr>
                    <td  height="38" class="art_col">街道地址<font color="red">*</font></td>
                    <td>
					<input type="text" name="address" id="address" style="width:400px" value="<%=address%>" onkeyup= "value=value.replace(/[^\w\u4E00-\u9FA5]/g,'');"  onbeforepaste= "clearSBC();"></textarea>
					</td>
                </tr>
			    <tr>
                    <td  height="38" class="art_col">邮政编码:
                    <td><input name="post_code" id="post_code" value="<%=post_code%>" type="text" maxlength="6" onkeyup='javascript:if(!/^[1-9][0-9]*$/.test(this.value)){this.value=""}'>
					</td>
                </tr>  		
          <tr>
                    <td  height="38" class="art_col">手机号<font color="red">*</font></td>
                    <td><input name="cellphone" id="cellphone" value="<%=cellphone%>" type="text" maxlength="11" onkeyup='javascript:if(!/^[1-9][0-9]*$/.test(this.value)){this.value=""}'>
					</td>
                </tr>                  
			    <tr>
                    <td  height="38" class="art_col">电话号码:</td>
                    <td><input name="tel" id="tel" value="<%=tel%>" type="text" maxlength="20" onkeyup='javascript:if(!/^[1-9][0-9]*$/.test(this.value)){this.value=""}'>
					</td>
                </tr>
            
			    <tr>
                    <td  height="38" class="art_col">最佳送货时间:</td>
                    <td>
						<select name="best_time">
							<option value="0" <%if(best_time.equals("0")){%>selected<%}%>>工作日、双休日与假日均可送货</option>
							<option value="1" <%if(best_time.equals("1")){%>selected<%}%>>只有双休日、假日送货（工作日不用送货)</option>
							<option value="2" <%if(best_time.equals("2")){%>selected<%}%>>只有工作日送货（双休日、假日不用送）</option>
						</select>
					</td>
                </tr>	                

			    <tr>
                    <td  height="38" class="art_col">排序</td>
                    <td><input name="level_no" id="infolevel" style="width:50px" value="<%=infolevel%>" type="text" maxlength="3" size="3" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" >
					</td>
                </tr>	
				<input type="hidden" name="bpm_id" id="bpm_id"  value="9722" />
	  			<input type="hidden" name="addr_id" id="addr_id"  value="<%=addr_id %>" />
				<input type="hidden" name="user_id" id ="user_id" value="<%=s_user_id %>" />
				
          </table>
				</form>
				</td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <tr>
              <td height="50" align="center">

						  <input type="button" name="Submit1" value="确定" class="button2" onclick="submitAddrs2()">
						  <input type="button" name="Submit2" value="返回" class="button2" onclick="window.location.href='index.jsp?menu_id=<%=menu_id%>';">
              </td>
            </tr>
          </table>
        </DIV>
      
      </DIV>
    </DIV>
  </div>
</div>